/**
 * 
 */
package com.an.java8.testlambda;

import java.util.stream.IntStream;
import java.util.stream.Stream;

/**
 * @author Administrator 求勾股数
 */
public class PythagoreanNumber {

	public static void main(String[] args) {
		// 先获取数组
		Stream<double[]> pythagoreArr = IntStream.rangeClosed(1, 100).boxed().flatMap(a -> IntStream.rangeClosed(a, 100)
				.mapToObj(b -> new double[] { a, b, Math.sqrt(a * a + b * b) }).filter(t -> t[2] % 1 == 0));

		pythagoreArr.forEach(t -> System.out.println("勾股数：[" + t[0] + "," + t[1] + "," + t[2] + "]"));
	}

}
